package com.haoze.nurseapp.vo.specimen;

import java.util.Objects;

/**
 * 文书对应的值
 *
 * @author wangze
 * @date 2020-05-21 8:16.
 **/
public class FileIndexValueVO {

	private String elementId;

	private String dataCode;

	private String dataValue;

	private String varCode;

	public String getElementId() {
		return elementId;
	}

	public void setElementId(String elementId) {
		this.elementId = elementId;
	}

	public String getDataCode() {
		return dataCode;
	}

	public void setDataCode(String dataCode) {
		this.dataCode = dataCode;
	}

	public String getDataValue() {
		// 如果是试管颜色,则将10进制转换为16进制，返回前端。
		final int hexColorSize=6;
		final String  cellTypeVarCode="spe_cell_color";
		if (cellTypeVarCode.equals(this.varCode)) {
			if (Objects.isNull(this.dataValue)) {
				return null;
			}
			String color = Long.toHexString(Long.valueOf(this.dataValue));
			int size = color.length();
			if (color.length() < hexColorSize) {
				for (int i = 0; i < hexColorSize - size; i++) {
					color += "0";
				}
			}
			return "#" + color;
		}
		return dataValue;
	}

	public void setDataValue(String dataValue) {
		this.dataValue = dataValue;
	}

	public String getVarCode() {
		return varCode;
	}

	public void setVarCode(String varCode) {
		this.varCode = varCode;
	}
}
